#include "Velocity.h"

//Default CTOR
Velocity::Velocity() 
	: m_vel(0), m_acc(0,0) {
}

//Velocity + Accel CTOR
Velocity::Velocity( float vel, const Acceleration &  acc, int step )
	: m_vel(vel), m_acc(acc), m_step(step) {
}

//Velocity CTOR
Velocity::Velocity( const Velocity & vel )
	: m_vel( vel.m_vel ), m_acc( vel.m_acc ), m_step(1) {
}

//operator=
const Velocity & Velocity::operator=( const Velocity & rhs ) {
	m_acc = rhs.m_acc;
	m_vel = rhs.m_vel;
	m_step = rhs.m_step;
	return *this;
}

//Dtor
Velocity::~Velocity() {
}

//Update Velocity and return
float Velocity::Tick() {
	return m_vel += m_acc.Tick() / m_step;
}

//Set new velocity
void Velocity::SetVelocity( float vel ) {
	m_vel = vel;
}

//Set new acceleration
void Velocity::SetAccel( const Acceleration & accel ) {
	m_acc = accel;
}

//Set new Stepping
void Velocity::SetStepping( int step ) {
	m_step = step;
}

//Return an acceleration
Acceleration Velocity::GetAcceleration() {
	return m_acc;
}

//Return a velocity
float Velocity::GetVelocity() {
	return m_vel;
}